package com.abcdefg.controller;


import com.abcdefg.api.ProduceApi;
import com.abcdefg.model.ProductInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("feign")
@RestController
public class TestFeign {
    @Autowired
    private ProduceApi produceApi;

    @RequestMapping("/o1")
    public String o1(Integer id) {
        return produceApi.p1(id);
    }

    @RequestMapping("/o2")
    public String o2(@RequestParam("id") Integer id, @RequestParam("name") String
            name) {
        return produceApi.p2(id, name);
    }

    @RequestMapping("/o3")
    public String o3() {
        ProductInfo productInfo1 = new ProductInfo();
        productInfo1.setId(1);
        productInfo1.setProductName("test1");
        return produceApi.p3(productInfo1);
    }

    @RequestMapping("/o4")
    public String o4() {
        ProductInfo productInfo1 = new ProductInfo();
        productInfo1.setId(2);
        productInfo1.setProductName("test2");
        return produceApi.p3(productInfo1);
    }
}
